Skip to content

Enhance disk driver and container status handling#1015

Merged
cgalibern merged 20 commits intoopensvc:mainfrom
cvaroqui:main
Apr 23, 2026
Merged

Enhance disk driver and container status handling#1015
cgalibern merged 20 commits intoopensvc:mainfrom
cvaroqui:main

Conversation

@cvaroqui
Copy link
Copy Markdown
Member

@cvaroqui cvaroqui commented Apr 21, 2026

Summary

This Pull Request includes enhancements, bug fixes, and refactoring across multiple files. It introduces performance improvements, better error handling, modularization, and improved configuration handling.

Main Changes:

  • Regex Optimizations: Refactored regex usage by pre-compiling patterns for better efficiency.
  • Improved Modularity: Introduced a new FS structure to replace repetitive code for handling file systems in pools.
  • Enhanced Error Handling:
    • Created custom error types and improved error filtering/logging.
    • Added support for explicitly ignoring expected errors in environment configuration retrievals.
  • Syntax Highlighting: Added syntax highlighting for INI-style configurations displayed in the TUI.
  • Code Organization:
    • Replaced inline code with helper functions for cleaner logic (e.g., in DRBD and volume handling).
    • Simplified ZFS volume creation option handling to reduce redundancy.
  • Feature Additions:
    • Introduced Vim syntax for OpenSVC configuration files.
    • Extended and improved argument quoting for safe shell execution.
  • Testing: Added new unit tests to validate argument quoting.
  • Comments Formatting: Improved documentation for selected comments to make them more explicit.

cvaroqui added 12 commits April 22, 2026 08:42
	mode = access

=>
	mode = bridge
The args.T type has a Parse func to convert a string to shlex-split
stringslice, but lacked a String func to do the reverse operation.
Example:

	items[0].data.status.resources."container#0".info.id = "a1c8c719730d5698af4262058c095823400893a5a5e655189ff20ce551fc7929"
	items[0].data.status.resources."container#0".info.image_id = "sha256:350b164e7ae1dcddeffadd65c76226c9b6dc5553f5179153fb0e36b78f2a5e06"
	items[0].data.status.resources."container#0".info.pid = 9880
	items[0].data.status.resources."container#0".info.name = "tty-proxy.container.0"
	items[0].data.status.resources."container#1".info.id = "d2e8bc2c8272ae950797ffef21e64eee654fc6b71f1cc5fb0d9debd11eaa231e"
	items[0].data.status.resources."container#1".info.image_id = "sha256:242b7b8f5dc73ba22b7c7599926156549ddb72c6e8fc776e5143fefbb4c0e4a6"
	items[0].data.status.resources."container#1".info.pid = 10330
	items[0].data.status.resources."container#1".info.name = "tty-proxy.container.1"
We observed a EBUSY error on a zvol destroy just after a
"drbdadm down <res>".

Make sure the kernel async teardown is finished before proceeding
with sub devices unprovisioners.
This patch also improves core/pool readability with a new pool.FS
type replacing the AddFS() very long prototype.

Also offer pool drivers a way to set default mnt_opt and mkfs_opt
values.
* Put fetched config in /var/tmp/opensvc
* Use a .conf.tmp suffix

So the opensvc config ftdetect pattern is matched.
This syntax was supported in version 2.1.

The patch adds a vpath.ErrAccess type that embeds the vol path
and avail state so the error receiver can format custom logs
from that.

Example:

	$ bin/om testnfs config show --section volume#1,app#0
	[volume#1]
	volatile = true
	size = 1m
	install = /nfs from ./cfg/{name} key script mode 750 user root group root

	[app#0]
	start = {name}-vol-1/nfs start
	stop = {name}-vol-1/nfs stop
	check = {name}-vol-1/nfs status

	$ bin/om testnfs instance status -r
	testnfs                      down
	└ instances
	  ├ dev2n2                   down  frozen node-frozen not-provisioned idle
	  └ dev2n1                   down  frozen node-frozen idle
	    └ resources
	      ├ volume#1   ........  down  testnfs-vol-1
	      │                            info: vol/testnfs-vol-1 avail down
	      └ app#0      ...../..  n/a   forking app.forking
	                                   info: not evaluated (vol/testnfs-vol-1 is down)
So we don't fail with ObjectNotFound when `stop = env` for example.
inspect can be nil even if GetInspect returned no error.
Ignored but logged issues:

* ObjectNotExist
* KeyNotExist
* ObjectNotDecoder

Example:

	$ bin/om svc1 config get --kw container#2.secrets_environment
	d/msg[456] idontexist/* e/*

	$ bin/om svc1 instance restart --rid container#2
	18:00:51.694 INF svc1: container#2: ignore env from idontexist/*: object sec/idontexist does not exists
	18:00:51.694 INF svc1: container#2: ignore env from e/*: object sec/e has no key matching '*'
@cgalibern cgalibern self-requested a review April 23, 2026 07:20
Comment thread drivers/rescontainerocibase/main.go Outdated
@cgalibern cgalibern merged commit b9a1908 into opensvc:main Apr 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants